Add the Mage Training Arena - #1282
HarleyGilpin wants to merge 16 commits into
Conversation
Consolidates the arena data under data/minigame/mage_training_arena and adds the objects, overlays, varbits (verified against the 634 cache: 1485 telekinetic, 1489 alchemist, 1488 enchanting, 1486 graveyard), areas and tuning tables the rooms will share. The doorway, room portals, exit portals, room overlays, item confiscation, safe death, teleport veto and a no_trading area tag are handled in MageTrainingArena; PizazzHat covers the Entrance Guardian dialogue and the hat's Talk-to/Destroy options.
Each player gets a private copy of region 13463 with one of ten mazes. Casting Telekinetic Grab on the statue slides it towards whichever side of the maze the player stands on until a wall stops it; reaching the exit square awards two points, spawns the Maze Guardian and every fifth maze in a row adds eight points, ten law runes and Magic experience. The statue's Observe option moves the camera above the maze.
Cupboard contents rotate and item values reshuffle on a world timer while anyone is in the room, with one item periodically free to convert. Alching the arena items produces arena coins that the coin collector turns into points, Magic experience and a banked reward capped at 1000 coins on the way out. Normal alchemy is refused inside the playground.
Shapes taken from the four piles enchant into orbs with any enchant spell at three quarters of the usual experience. Every tenth shape scores the spell's level in points, the bonus shape shouted by the guardian adds one, and the six private dragonstones score double straight away. Twenty orbs in the hole reward a handful of death, blood or cosmic runes.
Bone piles hand out four animals' bones before changing type, Bones to Bananas/Peaches converts each type into one to four fruit inside the room, and sixteen fruit through the food chute earn a point, Magic experience and a rune. Bones fall on everyone in the room every ten ticks and dying there costs up to ten Graveyard points. Bones to Bananas/Peaches tablets gain a Break option, which is refused inside the arena.
The Rewards Guardian's Trade-with option opens interface 197 backed by inventory 347; the client fills the point labels from the varbits and marks wand upgrades itself. Buying deducts the price from all four point pools, wand upgrades consume the previous tier, the arena book costs coins and Bones to Peaches sets the unlock varbit that the spellbook cast now requires.
The hat's equipment option was only registered for the inventory. Observe and Reset on the guardian statue tried to walk to it, which the maze walls prevent; they now run as approach interactions from up to ten tiles away like the Telekinetic Grab cast itself.
The room overlays were typed as full-screen overlays (root child 7 in both display modes), which the resizable layout doesn't show. Use the same game_screen_overlay parent as the fight cave and Barrows overlays.
Pre-quest lines for Wizard Shug, Apprentice Clerval, Wizard Dougal and Wizard Edvin. Rune Mechanics itself is not implemented, so Clerval's conversation stops short of offering the quest.
| objectOperate("Enter", "doorway_mage_training_arena") { | ||
| if (levels.get(Skill.Magic) < 7) { | ||
| statement("You need a Magic level of at least 7 to enter the guild.") | ||
| return@objectOperate | ||
| } | ||
| val direction = if (tile.y < 3300) Direction.NORTH else Direction.SOUTH | ||
| sound("mta_barrier") | ||
| anim("pass_through_barrier") | ||
| exactMoveDelay(tile.add(direction.delta.x * 2, direction.delta.y * 2), delay = 90, direction = direction, startDelay = 30) |
There was a problem hiding this comment.
The door entrance is a simple walkOverDelay y=+/-1 tile
There was a problem hiding this comment.
OSRS dump:
objectOperate("1", "magictraining_temple_door") {} // x = 3363, y = 3299, option = 1 id = 10721
walkToDelay(Tile(3363, 3300)) // from Tile(3363, 3298)
temporaryMoveType = MoveType.Walk
// zone update (56, 80, 0)
obj.anim("magictraining_light_door_open") // Tile(59, 83), shape = 10, rotation = 3, id = 3024
sound("light_beam_start") // 1302
There was a problem hiding this comment.
Switched to a plain walkOverDelay to the tile one past the door, with the door's open animation (3024) and the light beam sound (1302) from the capture; the exact move and the Magic gate are gone.
| player.message("You've been awarded $reward coins straight into your bank as a reward!") | ||
| } | ||
|
|
||
| companion object { |
There was a problem hiding this comment.
As none of these methods are used outside of this class they don't need to be in a companion object (having public methods in companion objects pollutes the global potential import list). Please apply to the other classes as well.
There was a problem hiding this comment.
Done across the package: the room scripts and the theatre have no companions now, and the remaining companion members on MageTrainingArena and PizazzHat are only the ones other classes call (lobby, inRoom, hasProgressHat, canEnter, hats, points, refresh).
| worldTimerTick("mta_alchemist") { | ||
| if (Players.none { MageTrainingArena.inRoom(it, "alchemist") }) { | ||
| return@worldTimerTick Timer.CANCEL | ||
| } | ||
| rotate() | ||
| Timer.CONTINUE | ||
| } |
There was a problem hiding this comment.
World timers don't really exist in rs and are more of a hack for things we don't quite know the mechanics of. In this, and many minigames, case the global changes is likely done by the timer of the npc. Typically referred to as "controller" npcs. (In some cases like pest control these npcs are invisible)
There was a problem hiding this comment.
Moved the three room cycles onto the guardians' soft timers (alchemy_guardian, enchantment_guardian, graveyard_guardian), started at spawn and running for the NPC's lifetime. The rotation, values, free item and bonus shape now live as variables on the guardian rather than static fields.
The doorway is a plain walk-over to the tile one past the door with the door's own open animation (3024) and the light beam sound (1302), matching the OSRS capture. The invented Magic 7 gate is gone; each room already checks its spell level.
Each room's guardian is its controller: its soft timer rotates the cupboards, changes the bonus shape and drops the bones, and it holds the room state (item values, rotation, free item, bonus shape) as NPC variables instead of static companion fields. The world timers and the start-on-entry / cancel-when-empty logic are gone; the timers run for the guardian's lifetime like any other NPC timer.
Only what another class uses stays in a companion: the lobby tile, the in-room check, the progress hat check and the shared portal rules (canEnter). The Telekinetic Theatre owns its own portal now, so its per-player statue and guardian state lives on the script instance and nothing in the package exports maze, hat tier or item helpers globally.
Adds the Mage Training Arena: the entrance hall, the progress hat, all four rooms and the rewards shop.
Content
The Entrance Guardian hands out the Pizazz Progress Hat, which upgrades through its three tiers as total points grow and resets all points if destroyed. The four portals check for the hat, the room's Magic level and the usual restrictions (no coins into the playground, no fruit into the graveyard, no familiars). Leaving a room by any route other than its exit portal, including logout and death, drops you at the entrance and removes any arena items. Teleports and trade requests are refused inside.
Telekinetic Theatre – a private instance of the arena map with one of ten mazes. Telekinetic Grab slides the statue towards whichever side of the maze you stand on until it hits a wall. Reaching the exit square gives 2 points and frees the Maze Guardian, who offers the next maze; five in a row adds 8 points, 10 law runes and 1000 Magic xp. Observe/Reset work on the statue.
Alchemists' Playground – cupboard contents rotate and item values reshuffle on the Alchemy Guardian's timer, with one item occasionally free to convert; the guardian holds the room state. Alching produces arena coins; the coin collector pays 1 point per 100 coins and 2 xp per coin, and 10% of what you deposit (up to 1000) is banked as real coins when you leave. Depositing 12000 or more ejects you.
Enchanting Chamber – shapes from the four piles enchant into orbs with any enchant spell at 75% xp. Every tenth shape scores the spell's level, the bonus shape the guardian shouts adds one, and the six dragonstones score double straight away and respawn later. Twenty orbs in the hole reward death, blood or cosmic runes.
Creature Graveyard – bone piles give four bones before changing type, each type converts to one to four fruit, and sixteen fruit through the chute earn a point, 50 xp and a rune. Bones fall on everyone in the room and dying there costs up to ten points.
Rewards Guardian – Trade-with opens the rewards interface. Buying deducts the price from all four point pools, wand upgrades consume the previous wand, the arena book costs 200 coins, and Bones to Peaches unlocks the spell.
Notes
TradeRequesthonours a newno_tradingarea tag;Alchemyrefuses non-arena items in the playground;BonesTogains the tablet Break option and the graveyard bone conversion.data/area/.../mage_training_arena/) and the tunables (values, intervals, caps, maze offsets, reward prices) live indata/minigame/mage_training_arena/.Tests
38 WorldTest cases across six files covering the lobby, each room's scoring paths, ejection/payout, death penalty, every shop purchase branch and the Bones to Peaches gate. Full
:game:testpasses.Unverified in client
Observe camera values, cupboard order around the room, overlay visuals. Draft until walked through in-game.